<?php

include('../../include/functions.inc.php');
include('../../include/maintenance.inc.php');

if (!isset($_SESSION['mCycle'])) {
    $maintenance = new Maintenance();

    $maintenance->windowTitle = 'Mantenimiento de Ciclos de Trabajo';
    $maintenance->newUrlPage = 'new.php';
    $maintenance->editUrlPage = 'edit.php';
    $maintenance->saveNewUrlPage = 'data.php?operation=s';
    $maintenance->updateUrlPage = 'data.php?operation=u';
    $maintenance->deleteUrlPage = 'data.php?operation=d';
    $maintenance->listJsonUrl = 'list.php';
    $maintenance->path = '../../';
    $maintenance->staticsUrl = 'index.php?statics=true';
    $maintenance->editUrlParams = array("CODE" => "CICLO");
    $maintenance->deleteUrlParams = array("CODE" => "CODE");
    $maintenance->table = "cllg_college_cycle";
    $maintenance->validations = array("required,CODE,Codigo de ciclo es requerido",
        "required,DATE_BEGIN,Fecha Inicio es requerida",
        "required,DATE_END,Fecha Fin es requerida",
        "digits_only,CODE,Codigo ciclo es numerico",
        "function,validCycleDates");
    $maintenance->globalCallBackJs = "config.js.php";
    $maintenance->aditionalScript = "functions.js.php";

    $_SESSION['mCycle'] = serialize($maintenance);
} else {
    $maintenance = unserialize($_SESSION['mCycle']);
}

if (!isEmpty(getParam('statics'))) {
    $maintenance->statics(count($db->query_select('cllg_college_cycle')));
} else {
    $maintenance->build();
}
?>